package com.lucy.flow.converter;

import com.lucy.common.utils.JsonUtil;
import com.lucy.flow.model.FlowModel;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 * @author kindear
 * 流程模型转化器
 */
@Converter
public class FlowModelConverter implements AttributeConverter<FlowModel,String> {
    @Override
    public String convertToDatabaseColumn(FlowModel flowModel) {
        return JsonUtil.obj2String(flowModel);
    }

    @Override
    public FlowModel convertToEntityAttribute(String s) {
        return JsonUtil.string2Obj(s,FlowModel.class);
    }
}
